<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //matchAll   需要全局匹配，返回迭代器接口
        var str = 'gfdg13411112222fdgdg18944445555'
        //捕获组命名
        // var reg = /(?<first>1[2-9])\d{9}/g
        // const result =[...str.matchAll(reg)]
        // for(var item of result){
        //     let{first} = item.groups
        //     console.log(first)
        // }
        //不捕获命名
        var reg1 = /(?:1[2-9])\d{9}/g
        const result1 = [...str.matchAll(reg1)]
        console.log(result1)

    </script>
</body>
</html>